/**
 * Created by lt on 2017/5/3.
 */
$(document).ready(function () {
    var userId = $("#userId").val();
    if (userId == 0) {
        $("#sellerName").val("星艺网")
    }
})


$(function () {
    /*$("#productEntityColourCode").cxColor();*/
    $("#form-member-add").validate({
        rules: {

        },
        onkeyup: false,
        focusCleanup: true,
        success: "valid",
        submitHandler: function (form) {
            var price = $("#price1").val();

            $("#price").val(price * 100);

            var postData = $('#form-member-add').serialize();

            $("#form-member-add").ajaxSubmit({
                cache: true,
                type: 'POST',
                data: postData,
                url: '/admin/productEntity/modifiyProductEntity',
                async: false,
                success: function (data) {
                    var data = $.parseJSON(data);
                    if (data.code != 1) {
                        layer.msg(data.msg, {icon: 5, time: 1000});
                        console.log(data.msg);
                        return;
                    }
                    console.log(postData);
                    layer.msg('操作成功!', {icon: 6, time: 1000}, function () {
                        window.parent.location.reload();
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);
                    })
                }
            })
        }
    });
});
